package com.my.hotel.mapper;

import com.my.hotel.entity.serverPage.JdUser;
import com.my.hotel.util.ILog;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface ClientMapper {
    @Select("select * from jd_user")
    List<JdUser> getList();

    @ILog("添加客户")
    @Insert("insert into jd_user values (null,#{username},#{password},#{name},#{sex},#{via},#{email},#{phone},#{status},NOW())")
    void addClient(JdUser client);
    @Delete("delete from jd_user where id=#{delId}")
    void delClient(int delId);
    @Select("select * from jd_user where id=#{id}")
    JdUser getClientById(int id);
    @Update("update jd_user set username=#{username},password=#{password},name=#{name},sex=#{sex},via=#{via}," +
            "email=#{email},phone=#{phone},status=#{status} where id=#{id}")
    void clientUpdate(JdUser client);
    @Select("select COUNT(*) from jd_user where username=#{username}")
    int getCountByName(String username);
}
